package com.njlime.cms.repository.app;

import com.njlime.cms.entities.Channel;
import com.njlime.core.base.repository.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by Dean on 2017-7-27.
 */
@Repository
public class AppChannelDaoImpl extends BaseDaoImpl<Channel> {


    /**
     * 获取频道列表
     * @param root_unit_id
     * @return
     */
    public List<Map<String,Object>> getChannelList(int root_unit_id){
        StringBuilder sb = new StringBuilder();
        List<Object> arrList = new ArrayList<Object>();
        sb.append(" SELECT ti.* FROM t_channel ti WHERE ti.unit_id = ? and ti.show_channel = 1 and ti.channel_type != 0 order by ti.channel_short");
        arrList.add(root_unit_id);
        List<Map<String,Object>> result = getListJdbc(sb.toString(), arrList);
        return result;
    }

}
